package com.interfaces.pay;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class CommPay {
    public static String outTradeNoGen(){
        /****************订单号生成*******************/
        Long times=new Date().getTime();
        LocalDateTime now = LocalDateTime.now();
        // 创建一个DateTimeFormatter实例，指定日期和时间的格式
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMddHHmmss");
        // 使用formatter格式化当前日期和时间
        String formattedDateTime = now.format(formatter);
        StringBuffer outTradeNoStr=new StringBuffer("FREE");
        outTradeNoStr.append(formattedDateTime);
        String timesStr=times.toString();
        String timesStr6=timesStr.substring(timesStr.length()-6,timesStr.length());
        outTradeNoStr.append(timesStr6);
        String outTradeNo=outTradeNoStr.toString();
        /***********************************/
        return outTradeNo;
    }
}
